/*
 * VideoEncode.hh
 *
 *  Created on: 2014-4-9
 *      Author: root
 */

#ifndef VIDEOENCODE_HH_
#define VIDEOENCODE_HH_

#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <sys/types.h>          /* See NOTES */
#include <sys/socket.h>
#include <arpa/inet.h>

extern "C"
{
#include "x264.h"
};

typedef struct
{
	x264_param_t *param;
	x264_t *x264_encoder;
	x264_picture_t *picture; //说明一个视频序列中每帧特点
	x264_nal_t *nal;
} Encoder;


#define CLEAR(x) (memset((&x),0,sizeof(x)))

//类的定义
class VideoEncode
{
public:
	static VideoEncode* createNew(int Width ,int Height);
	VideoEncode(int Width ,int Height);
	virtual ~VideoEncode(void);
public:
	Encoder encode_op;
	//初始化编码器
	void init_encoder(int Fps);
	//编码一帧图像
	int encode_frame(int frame_type, uint8_t *picture_in,uint8_t *picture_out);
	//释放编码器
	void release_encoder(void);
private:
	unsigned short 	m_usWidth;
	unsigned short 	m_usHeight;
};





#endif /* VIDEOENCODE_HH_ */
